import {request, METHOD} from '@/utils/request'
// import { getCurrentOrganizationId } from '@/utils/util.js'
// 当前租户ID
const organizationId = 0
// portal门户页面组件配置列表
export function getPersonalConfig(param) {
  return request(`/api/v1/${organizationId}/personal-configs/user`, METHOD.GET,param)
}
export function requestIcon(params) {
  return request({
      url: `/portal/v1/${organizationId}/funs/requestIcon?${params}`,
      method: 'get',
      headers: {
        "Content-Type": "image/png"
      },
      responseType: 'arraybuffer'
  })
}
export function quickEntrys(params) {
  return request({
      url: `/portal/v1/${organizationId}/quick-entrys/requestIcon?${params}`,
      method: 'get',
      headers: {
        "Content-Type": "image/png"
      },
      responseType: 'arraybuffer'
  })
}
// 根据接口返回的dataUrl获取各个模块的数据
export function getComponentDataList(url) {
  url = `/portal${url.replace('{organizationId}', organizationId)}`
  return request({
      url,
      method: 'get',
  })
}
export function getChartDataList(url) {
  url = `/project${url.replace('{organizationId}', organizationId)}`
  return request({
      url,
      method: 'get',
  })
}
// 获取待办区数据
// export function getToDoDataList (url, data = {}) {
//   url = `/portal${url.replace('{organizationId}', organizationId)}`
//   return request({
//     url,
//     method: 'post',
//     data
//   })
// }
export function getToDoDataList (data = {}) {
  return request({
    url: `/portal/v1/${organizationId}/todos/page`,
    method: 'post',
    data
  })
}
// 工作区模块编辑后提交接口
export function setPersonalConfig (method, data) {
  return request({
    url: `/portal/v1/${organizationId}/personal-configs`,
    method,
    data,
  })
}
// 调用功能区查询接口获取分类标识
export function getCategoryFromFuns() {
  return request({
      url: `/portal/v1/${organizationId}/funs`,
      method: 'get',
  })
}